require "import"
import "str"

--pid=...

--rc4=import "mods.minicrypto"

--import "android.support.v4.app.*"
--import "android.support.v4.view.*"
import "android.support.v4.widget.*"

topbar_click=0

--this.setDebug(true)

this.setContentView(loadlayout ({
  RelativeLayout,
  --layout_width="fill",
  --layout_height="fill",
  --visibility=4,
  backgroundColor=背景色,
  --orientation="vertical",
  --elevation="2%w",
  paddingTop=状态栏高度,
  {
    RelativeLayout,
    layout_width="fill",
    layout_height="56dp" ,
    gravity="center",
    padding="16dp",
    --backgroundColor=0xffffffff,
    elevation="2dp",
    paddingTop="8dp",
    paddingBottom="8dp",
    onClick=function()
      if topbar_click+2 > tonumber(os.time()) then
        scroll.smoothScrollTo(0,0)
       else
        topbar_click=tonumber(os.time())
      end
    end;
    {
      ImageView,
      src="drawable/back.png",
      layout_height="fill",
      layout_width="44dp",
      foreground=波纹(波纹色),
      onClick=function ()
        this.finish()
      end,
      padding="9dp",
      colorFilter=图标色,
    },
    
    {
      TextView,
      layout_width="fill",
      layout_height="fill",
      gravity="center",
      --layout_gravity="center",
      text="今日总结",
      textSize="20sp",
      textColor=文字色,
    },
  },
  {
  SwipeRefreshLayout,
  id="swipe",
  layout_width=-1,
  layout_height=-1,
    {
      ScrollView,
      layout_width=-1,
      layout_height=-1,
      id="scroll",
      {
        TextView,
        layout_width=-1,
        layout_height=-1,
        id="text",
        textSize="16sp",
        paddingTop="72dp",
        padding="16dp",
        textColor=文字色,
        textIsSelectable=true
      },
    },
  },
  {
    LinearLayout,
    layout_width="fill",
    layout_height="56dp" ,
    foreground=上下渐变({背景色,深透,淡透}),
  },
}))

function refresh()
swipe.setRefreshing(true)
Http.get("http://jieri.jpszx.com/", function(c,n)
  if c!=200 then
    toast("数据加载失败")
   else
    text.text=tostring(Html.fromHtml(n))
    :gsub("￼","")
  end
  swipe.setRefreshing(false)
end)
end

refresh()

swipe.setProgressViewOffset(true,dp2px(56),dp2px(32+56))
.setColorSchemeColors({文字色})
.setProgressBackgroundColorSchemeColor(背景色)
.onRefresh=refresh
